@import (reference) "../defs.less";
@import (reference) "../mixins/upload-diff.less";
@import (reference) "djblets/css/mixins/markdown.less";
@import (reference) "rb/css/ui/colors.less";


@img_base: '../../images';
@djblets_img_base: '../../../djblets/images';

@changedesc-bg: lighten(@review-request-bg, 5%);
@floating-anchor-width: 8em;


/****************************************************************************
 * Review-specific macros
 ****************************************************************************/

.review-comments-inline() {
  .comment-author {
    margin-bottom: 1em;

    label {
      .inline-editor-label();

      .avatar-container {
        background: white;
        border-radius: 50%;
        display: inline-block;
        overflow: hidden;
        width: 32px;
        height: 32px;
      }

      .user {
        color: @review-comment-author-color;
        font-size: 1.1em;
        font-weight: bold;
        text-decoration: none;
      }

      .user-reply-info {
        display: inline-block;
        overflow: hidden;

        .timestamp {
          color: #487858;
          display: block;
          text-decoration: none;

          &:hover {
            text-decoration: underline;
          }

          time {
            vertical-align: middle;
          }
        }
      }
    }
  }

  /*
   * When there's a draft present, modify some colors so that it's apparent
   * that the comments are drafts, and modify margins so that the inline editor
   * opens without any jumps.
   */
  &.draft {
    @textarea-offset-vert: (@textarea-editor-margin-top +
                            @textarea-editor-padding +
                            @textarea-border-size);
    @textarea-offset-horiz: (@textarea-editor-padding +
                             @textarea-border-size);

    .comment-author {
      margin-bottom: @textarea-offset-vert + 1em;

      label a {
        color: @review-comment-author-color-draft;
      }
    }

    .text-editor {
      margin: -(@textarea-offset-vert - 10px) -@textarea-offset-horiz 0;
    }
  }
}


/****************************************************************************
 * Code Mirror
 ****************************************************************************/
.CodeMirror {
  border: @textarea-border;
  height: auto;
  margin: @textarea-editor-margin;
  cursor: text;

  .CodeMirror-lines {
    padding: @textarea-editor-padding;
  }

  .CodeMirror-scroll {
    /*
     * Prevent Chrome (and maybe other browsers) from scrolling the page
     * when trying to scroll past the bounds of the text editor.
     */
    overscroll-behavior-y: none;
  }

  pre {
    padding: 0;
  }

  pre.CodeMirror-line,
  pre.CodeMirror-line-like {
    /* Turn off CodeMirror's own padding, since we're setting ours. */
    padding: 0;
  }

  .cm-header {
    color: black;
  }

  /**
   * Highlight Markdown string literals and wrap it in a box.
   *
   * This is a bit complex, due to how CodeMirror represents literals. For
   * a text like::
   *
   *     `literal`
   *
   * The following spans are generated::
   *
   *     <span class="cm-formatting cm-formatting-code cm-rb-markdown-code"/>
   *     <span class="cm-rb-markdown-code"/>
   *     <span class="cm-formatting cm-formatting-code cm-rb-markdown-code"/>
   *
   * (The ``.cm-formatting-code`` spans represent the backticks.)
   *
   * Furthermore, when selected, we may get several of that inner span.
   *
   * The goal is to display a curved rectangle around the whole string of
   * spans, and to do so with the border sitting just outside the content
   * box.
   *
   * To do this, we place the border and offsets in ``:before``. This avoids
   * affecting the bounding box of the line (previous versions of Review Board
   * used negative margins, which had side-effects).
   *
   * We also have to figure out the starting and ending ``.cm-formatting-code``
   * backtick spans in a range, without hitting issues when there are
   * side-by-side literal blocks. To do this, we:
   *
   * 1) Set some defaults (offsets and top/bottom borders) that pertain to
   *    every one of the spans.
   *
   * 2) Set a default border-left on the ``.cm-formatting-code`` spans,
   *    aimed at the first span in a series.
   *
   * 3) Use a more complex ``:not() + ...`` rule to attempt to match the
   *    last ``.cm-formatting-code`` span, where we set a border-right and
   *    unset the border-left.
   *
   *    We use the ``:not()`` in order to skip any text that may have
   *    followed a previous set of spans. Without this, we'd match the
   *    first border and would unset the border-left if it followed another
   *    literal.
   */
  .cm-rb-markdown-code {
    background-color: @inline-code-bg;
    color: @inline-code-text-color;
    display: inline-block;
    position: relative;

    &:before {
      content: "";
      border-top: @inline-code-border-size solid @inline-code-border-color;
      border-bottom: @inline-code-border-size solid @inline-code-border-color;
      position: absolute;
      left: -@inline-code-border-size;
      right: -@inline-code-border-size;
      top: -@inline-code-border-size;
      bottom: -@inline-code-border-size;
    }

    &.cm-formatting-code:before {
      border-left: @inline-code-border-size solid @inline-code-border-color;
      border-top-left-radius: @inline-code-border-radius;
      border-bottom-left-radius: @inline-code-border-radius;
    }

    &:not(.cm-formatting-code) + .cm-rb-markdown-code.cm-formatting-code:before {
      border-left: 0;
      border-right: @inline-code-border-size solid @inline-code-border-color;
      border-top-left-radius: 0;
      border-top-right-radius: @inline-code-border-radius;
      border-bottom-right-radius: @inline-code-border-radius;
      border-bottom-left-radius: 0;
    }

    &.CodeMirror-selectedtext {
      background: inherit;
    }

    &.cm-formatting-code-block {
      background: none;

      &:before {
        border: 0;
        border-radius: 0;
      }
    }
  }

  .cm-variable-2 {
    color: black;
  }
}

.markdown-info {
  color: @link-color;
  font-size: 8pt;
  font-weight: normal;
  float: right;
  line-height: 25px;
  margin-right: 0.5em;
  text-decoration: none;

  .on-mobile-medium-screen-720({
    /* Let the Markdown Reference link flow to the next line. */
    display: block !important;
    float: none;
    margin-top: 0.5em;
  });

  &:hover {
    text-decoration: underline;
  }
}


/****************************************************************************
 * Review UIs
 ****************************************************************************/
.review-ui-box {
  &.has-review-ui-box-content .review-request-actions-container {
    .actions > li:last-child {
      border-radius: 0 @box-inner-border-radius 0 0;
    }
  }

  &.has-prev-attachment .review-request {
    margin-left: 1em;
  }

  &.has-next-attachment .review-request {
    margin-right: 1em;
  }

  .actions-container {
    .actions > li:last-child {
      border-radius: 0 @box-inner-border-radius @box-inner-border-radius 0;
    }
  }

  .review-ui-box-content {
    border: 1px @review-request-border-color solid;
    border-top: 0;
    clear: both;
    padding: 0;
    min-height: 5em;
  }

  .review-ui-header {
    border-bottom: 1px @diff-file-border-color solid;
    background: @review-ui-header-bg;
    min-height: 2em;

    h1 {
      margin: 0;
      padding: 8px;
      font-size: 10pt;
      line-height: 16px;

      &.file-attachment-single-revision {
        text-align: center;
      }
    }
  }
}

.review-ui-next-attachment,
.review-ui-prev-attachment {
  background: @box-bg;
  border: 1px solid @box-border-color;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  padding: 2px;
  position: fixed;
  top: 50%;
  transition: transform 0.3s, background 0.3s, margin 0.3s;
  z-index: @z-index-base;

  &:hover {
    background: darken(@box-bg, 10%);
    transform: translateY(-50%);
  }

  a {
    color: black;
    text-decoration: none;
  }

  .file-container {
    display: inline-block;
    float: none;
    vertical-align: middle;
  }
}


.review-ui-next-attachment {
  border-right-width: 0;
  border-radius: @box-border-radius 0 0 @box-border-radius;
  margin-right: @page-container-padding;
  right: -2px;
  transform: translateY(-50%) translateX(100%);

  &:hover {
    margin-right: 0;
  }
}

.review-ui-prev-attachment {
  border-left-width: 0;
  border-radius: 0 @box-border-radius @box-border-radius 0;
  margin-left: @page-container-padding;
  left: -2px;
  transform: translateY(-50%) translateX(-100%);

  &:hover {
    margin-left: 0;
  }
}


/****************************************************************************
 * Entries (status updates, reviews, change descriptions)
 ****************************************************************************/

.review-request-page-entry {
  clear: both;
  margin: 2rem 0;

  .on-mobile-medium-screen-720({
    margin-top: 1rem;
  });

  &:last-child {
    margin-bottom: 0;
  }

  .collapse-button {
    border: 1px #333333 solid;
    cursor: pointer;
    float: left;
    margin-right: 0.5rem;
    margin-top: -1px;
    padding: 0;
  }
}

.review-request-page-entry-contents {
  background-color: @review-request-entry-base-bg;
  border: 1px @box-border-color solid;
  border-radius: @box-border-radius;
  box-shadow: @box-shadow;

  &.collapsed {
    background-color: @review-request-entry-collapsed-bg !important;
    background-image: none !important; // Override any gradients used.

    .body,
    .banners {
      display: none;
    }

    .header {
      border-radius: @box-border-radius;
    }
  }

  .has-avatar & {
    margin-left: 80px;
    width: auto;

    .left-arrow-callout(@review-request-entry-base-bg);

    .on-mobile-medium-screen-720({
      margin-left: 0;
      margin-top: 1em;

      &:after, &:before {
        content: none;
      }
    });

    &.collapsed {
      .left-arrow-callout-color(@review-request-entry-collapsed-bg);
    }
  }

  .header {
    border-radius: @box-border-radius @box-border-radius 0 0;
    padding: @review-request-entry-padding;

    a {
      color: black;
      text-decoration: none;
    }

    .header-details {
      line-height: 20px;
      overflow: hidden;
    }

    .summary {
      float: left;
      font-size: 110%;
      font-weight: bold;

      .on-mobile-medium-screen-720({
        float: none;
      });

      .review-request-page-entry-title {
        vertical-align: middle;
      }
    }

    .timestamp {
      color: #555;
      display: block;
      text-align: right;

      .on-mobile-medium-screen-720({
        margin-top: 0.5rem;
        text-align: left;
      });

      &:hover {
        text-decoration: underline;
      }
    }
  }

  .banner {
    border-width: 0 0 1px 0;
    box-sizing: border-box;
    margin: 0;
    padding: @review-request-entry-padding;

    &.floating {
      border-top: 0;
      margin-top: 0;
    }
  }
}

.new-review-request-page-entry .review-request-page-entry-contents {
  border-color: @review-request-entry-new-border-color;

  .left-arrow-callout-border-color(@review-request-entry-new-border-color);
}


/****************************************************************************
 * Reviews
 ****************************************************************************/

.review.has-draft {
  // Reviews with draft replies have a green header.
  .review-request-page-entry-contents {
    .left-arrow-callout-color(@draft-color);
  }

  .header {
    background: @draft-color;
  }

  .review-request-page-entry-contents:not(.collapsed) .header {
    /*
     * When the box is expanded, there's @review-request-entry-padding space
     * between the header and the banner. We take that space out of the header
     * instead of the banner to ensure that nothing jumps when the banner is
     * switching between fixed and floating modes.
     */
    padding-bottom: 0;
  }
}

.review-comments {
  border: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.review-comment-screenshot,
.review-comment-file-attachment,
.review-comment-diff {
  background-color: @review-comment-filename-background-color;
  border: 0px @review-comment-filename-border-color solid;

  .diffrevision {
    font-weight: normal;
  }
}

.review-comment-screenshot,
.review-comment-file-attachment{
  border-width: 1px 0;
  padding: 5px;

  .filename {
    color: black;
    font-size: 120%;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
  }

  .thumbnail {
    margin-top: 0.5em;
  }

  li:not(:first-child) > .review-comment-details > & {
    margin-top: @review-comment-section-margin-top;
  }
}

.review-comment-diff {
  &.allow-transitions {
    .sidebyside {
      /*
       * Set up some animations for the hover effects on diff fragments.
       *
       * When collapsed, the contents of the diff headers will be transparent,
       * showing just a few pixels of the background to show that there's
       * something there.
       *
       * When expanding, the contents will be fully opaque.
       *
       * Both are done as transitions and their states managed in JavaScript.
       * The result is that the controls will appear to expand outward from the
       * diff (using transforms, without impacting the layout of the rest of the
       * page), with the contents fading in/out.
       */
      &,
      thead,
      .diff-header,
      .diff-header td > div {
        transition: all 0.3s linear;
      }
    }
  }

  th {
    /*
     * The line numbers aren't clickable in the comment fragments in reviews,
     * so show a standard cursor instead of a pointer.
     */
    cursor: initial;
  }

  .sidebyside {
    &:not(.has-diff-header-above) {
      /*
       * If there's no diff header above, then we won't have a file header
       * that's retracted. In this case, we want to add back the margin that
       * we'd normally have in a comment section.
       */
      margin-top: @review-comment-section-margin-top;
    }

    &:not(.has-diff-header-below) {
      /*
       * Diff comment sections don't have a bottom border. We leave it up to
       * the diff headers to supply one normally. If there isn't a diff header
       * below the diff, add our own border.
       */
      border-bottom: 1px @review-comment-filename-border-color solid;
    }

    &.collapsed .diff-header td > div {
      opacity: 0;
    }

    &.expanded .diff-header td > div {
      opacity: 1;
    }

    .filename-row th {
      background: @review-comment-filename-background-color;

      /*
       * This replaces the border that would normally be at the top of
       * .review-comment-diff. We put it here instead so that it will appear
       * on the top of the header when it animates, instead of staying fixed
       * above it.
       */
      border-top: 1px @review-comment-filename-border-color solid;

      /*
       * Normally the revision row has this border, but for diff fragments,
       * we want to place it on the filename row.
       */
      border-bottom: 1px @diff-file-border-color solid;
    }

    .diff-header {
      &-above {
        transform-origin: bottom;
      }

      &-below {
        transform-origin: top;
      }

      td > div {
        overflow: hidden;
      }
    }

    .first-comment-line {
      td, th {
        border-top: 1px black solid;
      }
    }

    .last-comment-line {
      td, th {
        border-bottom: 1px black solid;
      }
    }
  }

  .diff-error tbody {
    border: 1px @diff-error-border-color solid;
  }
}

/*
 * An anchor beside a review box.
 *
 * This is used to help generate a link to a particular comment or reply on
 * a page. It will appear to the left of the review box, aligned with the
 * linked item, when hovering over the item.
 *
 * Consumers need to call ``.setup-floating-anchor()`` on the container that
 * should respond to the hover.
 */
.floating-anchor {
  box-sizing: border-box;
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  text-align: right;
  padding-top: 1em;
  z-index: @z-index-deco;

  a {
    color: #BBB;
    font-size: 120%;
    padding: 1em;
    text-decoration: none;

    &:hover {
      color: #888;
    }
  }
}

/**
 * Set up the floating anchor for a parent container.
 *
 * Args:
 *     container-offset-left (number):
 *          An additional offset to get the floating anchor's right-hand
 *          side to match the left-hand side of the review box. This should
 *          be the value of any parent container's padding.
 *
 *     margin-left (number):
 *          An additional margin to apply to the floating anchor. This is
 *          there to help nudge based on a pixel amount (for use in the left
 *          border for replies).
 */
.setup-floating-anchor(@container-offset-left: 0, @margin-left: 0) {
  &:hover .floating-anchor {
    display: block;
  }

  .on-mobile-medium-screen-720({
    .floating-anchor {
      /*
       * On mobile, we're going to show this on the right-hand side of the box
       * instead, optimistically.
       */
      left: auto;
      right: 0;
      padding-right: 0;
      margin-left: 0;
      width: auto;
    }
  });

  .set-floating-anchor-offset(@container-offset-left, @margin-left);
}

/**
 * Set the offset for an existing floating anchor.
 *
 * Args:
 *     container-offset-left (number):
 *         The new offset for the floating anchor.
 *
 *     margin-left (number):
 *          An additional margin to apply to the floating anchor. This is
 *          there to help nudge based on a pixel amount (for use in the left
 *          border for replies).
 */
.set-floating-anchor-offset(@container-offset-left: 0, @margin-left: 0) {
  .floating-anchor {
    left: -@floating-anchor-width - @container-offset-left;
    width: @floating-anchor-width + max(@container-offset-left, 0);
    padding-right: max(@container-offset-left, 0);
    margin-left: @margin-left;

    .on-mobile-medium-screen-720({
      margin-right: -@container-offset-left;
    });
  }
}

.review-comment-details {
  position: relative;

  .setup-floating-anchor(
    @container-offset-left: @review-request-entry-link-offset,
    @margin-left: @review-request-entry-link-margin-left);

  .has-avatar & {
    .set-floating-anchor-offset(
      @container-offset-left: @review-request-entry-has-avatar-link-offset,
      @margin-left: @review-request-entry-has-avatar-link-margin-left);
  }

  .review-comment {
    padding: @review-comment-padding;
  }

  &.comment-details-empty .review-comment {
    padding: 0;
  }
}

.review-comment-thread {
  padding: 0 @review-comment-padding @review-comment-padding
           @review-comment-padding;

  .has-avatar & {
    .reply-comments > li {
      .set-floating-anchor-offset(
          @container-offset-left: @review-comment-padding -
                                  @review-request-entry-has-avatar-link-offset,
          @margin-left: -@review-comment-border-left-size +
                        @review-request-entry-has-avatar-link-margin-left);
    }
  }

  .comment-text {
    white-space: pre-wrap;
  }

  .controls {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;

    a {
      color: black;
      display: inline-block;
      text-decoration: none;
      background: #ECECEC;
      border: 1px #C3C3C3 solid;
      margin-top: 2em;
      padding: 0.6em 1em;
      border-radius: @box-border-radius;

      &:hover {
        background: #F3F3F3;
      }

      .fa {
        margin-right: 5px;
      }
    }

    li {
      display: inline;
    }
  }

  .reply-comments {
    margin: 0;
    padding: 0;

    > li {
      border-left: @review-comment-border-left-size transparent solid;
      list-style: none;
      padding: 2em;
      position: relative;

      &.new-reply {
        border-left-color: @review-request-entry-new-border-color;
      }

      .setup-floating-anchor(
        @container-offset-left: @review-comment-padding +
                                @review-request-entry-link-offset,
        @margin-left: -@review-comment-border-left-size +
                      @review-request-entry-link-margin-left);
      .review-comments-inline();
    }
  }
}

#reviews {
  .box-statuses {
    float: left;
    text-align: center;

    .on-mobile-medium-screen-720({
      margin-top: 3em;
      float: none;
    });

    .box-status {
      position: relative;
      transition: 0.2s linear all;

      &.has-issues {
        &.revoking-ship-it,
        &.ship-it:hover {
          .ship-it-label {
            top: 23px;
          }
        }

        .avatar-container {
          border-color: darken(@issue-opened-bg, 45%);
        }
      }

      &.ship-it .avatar-container {
        border-color: #6ebf20;
      }

      &.ship-it.has-issues {
        .avatar-container {
          border-color: darken(@issue-opened-bg, 45%);
        }

        .fix-it-label {
          z-index: 1;
        }

        .ship-it-label {
          top: 3px;
          margin-left: 2px;
          padding-left: 2px;
          padding-right: 2px;
        }
      }

      .avatar-container {
        background: white;
        border: 2px #CCC dotted;
        border-radius: 50%;
        overflow: hidden;
        width: 48px;
        height: 48px;
        margin: 0 9px;
        transition: border-color 0.4s ease-in-out;

        .on-mobile-medium-screen-720({
          display: inline-block;
          vertical-align: top;
        });

        img {
          border: 2px white solid;
          box-sizing: border-box;
        }
      }

      .labels-container {
        margin-top: -5px;
        position: relative;

        .on-mobile-medium-screen-720({
          display: inline-block;
          margin-top: 0;
          top: 4px;
        });
      }

      label {
        border: 1px #888888 solid;
        border-radius: @box-border-radius;
        display: block;
        line-height: 1.5;
        margin-bottom: @page-container-padding;
        padding: 2px 4px;
        position: absolute;
        left: 0;
        top: 0;
        width: 5.5em;

        .on-mobile-medium-screen-720({
          margin-bottom: 0;
        });

        &.fix-it-label,
        &.ship-it-label {
          -webkit-transition-delay: 0.2s;
          transition-delay: 0.2s;
        }

        &.ship-it-label {
          border: 1px darken(#aeff60, 40%) solid;
          background: #aeff60;
          position: absolute;

          transition: padding 0.2s ease-in-out,
                      top 0.2s ease-in-out,
                      margin 0.2s ease-in-out,
                      left 0.5s ease-in-out,
                      opacity 0.8s ease;

          .revoke-ship-it {
            cursor: pointer;
            font-size: 110%;
            margin-left: 0.1em;
            opacity: 0.35;
            transition: opacity 0.2s ease;

            &:hover {
              opacity: 1;
            }
          }
        }

        &.fix-it-label {
          border: 1px darken(@issue-opened-bg, 50%) solid;
          background: @issue-opened-bg;

          transition: left 0.5s ease-in-out,
                      opacity 0.8s ease;

          .open-issue-count {
            color: darkred;
            display: block;
          }
        }
      }
    }
  }
}

#reviews .review {
  .body {
    clear: both;

    pre {
      white-space: pre-wrap;
    }
  }
}

#view_controls {
  list-style: none;
  margin: 2em 0;
  text-align: center;

  a,
  button {
    background: #E0E0E0;
    border: 1px #C3C3C3 solid;
    border-radius: @box-border-radius;
    color: black;
    display: inline-block;
    font-size: inherit;
    padding: 0.6em 1em;
    text-decoration: none;

    &:hover {
      background: #ECECEC;
    }
  }

  li {
    display: inline-block;
    margin: 1em;
    padding: 0;
  }

  .rb-icon {
    vertical-align: top;
  }
}

.sidebyside.loading {
  tbody {
    background-color: #F3F3F3;

    // Helps us better keep the size, as long as the comment is within a chunk.
    padding: 2px 2px 1px 2px;

    td {
      padding: 4px;
      font-size: 20px;
      text-align: center;
    }
  }
}


/****************************************************************************
 * Change Descriptions
 ****************************************************************************/

.changedesc {
  .review-request-page-entry-contents {

    background-color: @changedesc-bg;
    #gradient > .vertical(@changedesc-bg, @review-request-bg);

    .left-arrow-callout-color(@changedesc-bg);
  }

  .changed-fields {
    clear: both;
    padding: @review-request-entry-padding;

    &>ul {
      list-style: none;
      margin: 1em 0 1em 0;
      padding: 0;

      &>li {
        margin: 3em 0 0 0;

        &:first-child {
          margin-top: 0;
        }
      }
    }

    a {
      color: default;
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    }

    /* Field labels */
    h3 {
      color: @review-request-label-color;
      font-size: 110%;
      margin: 0;
      padding: 0;

      &.status {
        /* Add some separation between this and the other fields. */
        margin-bottom: 2em;

        &:last-child {
          /*
           * If it's the last child, we don't want that separation, or it'll
           * have an odd amount of extra space.
           */
          margin-bottom: 0.5em;
        }

        .value {
          color: black;
          font-weight: normal;
        }
      }
    }

    /* Used in the textarea field diffs and the Change Summary section. */
    > pre {
      background-color: #FFFFFF;
      border: @textarea-border;
      padding: @textarea-editor-padding;
      font-size: 9pt;
      white-space: pre-wrap;
    }

    /*
     * File attachment/screenshot change lists.
     *
     * These differ from the other field change lists in that they have
     * mini-section labels underneath for each file.
     */
    .caption-changed {
      margin: 2em 0 0 2em;
      padding: 0;

      a {
        /* Treat the link like a field. */
        font-weight: bold;
      }

      td, th {
        vertical-align: top;
      }

      td {
        padding-left: 1em;
      }

      th {
        text-align: right;
      }
    }

    /* Displays changes for field values, with "-" and "+" markers. */
    .changed {
      border: @textarea-border;
      border-collapse: collapse;
      display: inline-block;
      margin: 0;
      padding: 0;
      vertical-align: top;

      a {
        color: blue;
        text-decoration: none;

        &:first-child {
          margin-left: 0;
        }

        &:hover {
          text-decoration: underline;
        }
      }

      td, th {
        font-family: @textarea-font-family;
        padding: 0.3em 0.6em;
      }

      td {
        background: #FEFEFE;
      }

      .new-value .marker {
        background: @diff-insert-linenum-color;
      }

      .old-value .marker {
        background: @diff-delete-linenum-color;
      }
    }

    /* The "Change Summary" section. */
    .changedesc-text {
      margin: @textarea-editor-margin-top 0 1.5rem;
      padding: @textarea-editor-padding;
      overflow: hidden;

      .codehilite {
        .flush-codehilite();
      }

      &:last-child {
        margin-bottom: 0;
      }
    }

    /* The diff for text areas. */
    .diffed-text-area {
      background: white;
      border: @textarea-border;
      border-collapse: collapse;
      padding: 0;
      width: 100%;

      a {
        text-decoration: underline;
      }

      p {
        padding-top: 2px;
        padding-bottom: 2px;
      }

      pre {
        background: none;
        border: 0;
        margin: 0;
        padding: 0;
        white-space: pre-wrap;
      }

      td {
        font-family: @textarea-font-family;
        padding: 0 4px;
        vertical-align: top;
        white-space: pre-wrap;

        .codehilite {
          border-radius: 0;
          border-left: 0;
          border-right: 0;

          // Make this flush with the sides of the row.
          margin: 0 -4px;

          pre:empty {
            /* Give this a reasonable height so it's not just blank. */
            height: 1rem;
          }
        }
      }

      .delete {
        .line {
          background: @diff-delete-color;
        }

        /* The '-' or '+' marker. */
        .marker {
          color: #990000;
          background: @diff-delete-linenum-color;
        }
      }

      .insert {
        .line {
          background: @diff-insert-color;
        }

        /* The '-' or '+' marker. */
        .marker {
          background: @diff-insert-linenum-color;
        }
      }

      .line {
        width: 100%;

        /*
         * Make sure any images in the Markdown-rendered text are kept
         * small, but with the correct aspect ratio.
         */
        img {
          width: auto;
          max-height: 100px;
        }
      }

      /* The '-' or '+' marker. */
      .marker {
        background: #F9F9F9;
        font-family: @textarea-font-family;
        font-size: @textarea-font-size;
        font-weight: bold;
        text-align: center;
      }

      .replace-new {
        .line {
          background: @diff-insert-color;

          .hl {
            background: desaturate(darken(@diff-insert-color, 15%), 30%);
          }
        }

        /* The '-' or '+' marker. */
        .marker {
          background: @diff-insert-linenum-color;
        }
      }

      .replace-old {
        .line {
          background: @diff-delete-color;

          .hl {
            background: desaturate(darken(@diff-delete-color, 10%), 20%);
          }
        }

        /* The '-' or '+' marker. */
        .marker {
          background: @diff-delete-linenum-color;
        }
      }
    }

    /* Styling for the "Diff" field updates. */
    .diff-changes {
      .line-counts {
        margin-left: 0.5em;

        .delete-count {
          color: @diff-delete-line-count-color;
        }

        .insert-count {
          color: @diff-insert-line-count-color;
        }
      }
    }

    /* Styles for the file listing for the "Diff" field. */
    .diff-index {
      margin-bottom: 0;

      .diff-file-icon {
        min-width: 20px;
        min-height: 20px;
      }

      .diff-file-info {
        /* Compensate for the lack of diff-chunks-cell column. */
        width: 100%;
      }
    }

    .primary-fields {
      h3:first-child {
        margin-top: 2em;
      }
    }

    /*
     * Secondary fields are in more of a Field: Value display, with the
     * fields lining up.
     */
    .secondary-fields {
      width: 100%;

      .on-mobile-medium-screen-720({
        display: block;
      });

      h3 {
        margin: 0 1em 0 0;
        padding: 0;
        text-align: right;

        .on-mobile-medium-screen-720({
          margin: 0;
          text-align: left;
        });
      }

      &>tbody>tr {
        &>td,
        &>th {
          padding: 0.5em 0;
          vertical-align: top;
          white-space: nowrap;

          .on-mobile-medium-screen-720({
            display: block;
            white-space: normal;
          });
        }

        &>td {
          /*
           * Between this and the white-space: nowrap above, the field labels
           * will end up taking the minimum size without wrapping, and the
           * rest of the width will be given to the value.
           */
          width: 100%;

          &>p {
            /*
             * If the field value is rendered inside a <p>, make sure it
             * aligns with the field label.
             *
             * Note that the label has a larger font than this, so we can't
             * reuse the same pixel value. We have to bump it.
             */
            &:first-child {
              margin-top: 3px;
            }

            /* Don't take up more room than we need in the last <p>. */
            &:last-child {
              margin-bottom: 0;
            }
          }
        }

        &>th {
          .on-mobile-medium-screen-720({
            margin-top: 2em;
          });
        }
      }
    }
  }
}

.changedesc-status-updates {
  background-color: white;
  border-radius: 0 0 @box-border-radius @box-border-radius;
}


/****************************************************************************
 * Updates Bubble
 ****************************************************************************/

#updates-bubble {
  background: #FFF1AB;
  border-top: 1px #888866 solid;
  border-left: 1px #888866 solid;
  bottom: 0;
  border-radius: 10px 0 0 0;
  box-shadow: -1px -1px 2px rgba(0, 0, 0, 0.15);
  font-size: 110%;
  padding: 1em;
  position: fixed;
  right: 0;
  z-index: @z-index-page-overlay;

  a, a:visited {
    color: #0000CC;
    text-decoration: none;
  }

  #updates-bubble-buttons {
    margin-left: 2em;
  }
}


/****************************************************************************
 * Review Dialog
 ****************************************************************************/
#review-form {
  @review-dialog-padding: 20px;

  overflow: auto;
  margin: 0;
  padding: @review-dialog-padding;;

  label {
    color: black;
    font-weight: bold;
    margin-top: 10px;
  }

  .add-link {
    font-size: 110%;

    &:visited {
      color: @link-color;
    }
  }

  .delete-comment {
    color: #000000;
  }

  .comment-label {
    color: #AB5603;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 2em;
    text-decoration: none;

    .inline-editor-label();
  }

  .comment-text-field {
    margin-bottom: 1em;
  }

  .rich-text {
    margin-bottom: 2em;
  }

  .text-editor {
    width: inherit;
  }

  #review-form-comments {
    background: none;
    position: relative;

    pre {
      white-space: pre-wrap;
    }

    .diffrevision {
      font-weight: normal;
    }

    .file-attachment {
      background: @review-comment-filename-background-color;
      border-color: @review-comment-filename-border-color;
      border-width: 1px 0;
      border-style: solid;
      margin: 0 -@review-dialog-padding;
      padding: 5px;

      .diffrevision,
      .filename {
        font-size: 120%;
      }

      .filename {
        font-weight: bold;

        a {
          color: black;
        }
      }

      .thumbnail {
        margin-top: 1em;
      }
    }

    .review-comments {
      list-style: none;
      margin: 0;
      padding: 0;

      > li {
        margin: 2em 0;
        padding: 0;

        .review-comments-inline();
      }
    }

    .review-dialog-comment-diff {
      margin: 0 -@review-dialog-padding;
    }

    .sidebyside {
      border-color: @review-comment-filename-border-color;
      border-width: 1px 0;
      border-style: solid;

      .filename-row th {
        background: @review-comment-filename-background-color;
        border-bottom: 1px @review-comment-filename-border-color solid;
      }
    }

    .spinner {
      font-size: 20px;
    }

    .delete-comment {
      margin-left: 0.5em;
      font-size: 1.25em;
      line-height: normal;
    }

    .editicon {
      margin-left: 0.5em;
    }
  }
}

#review-form-modalbox {
  .modalbox-buttons {
    left: 0;

    .review-dialog-buttons-left {
      /*
       * We're only absolutely positioning the buttons-left and not
       * buttons-right. This way, buttons-right dictates the height, and
       * buttons-left is able to fit in on the same row.
       */
      position: absolute;
      left: 0;
    }

    .on-mobile-medium-screen-720({
      .review-dialog-buttons-left {
        position: relative;
      }

      .review-dialog-buttons-left,
      .review-dialog-buttons-right {
        display: inline;
      }
    });
  }
}


/****************************************************************************
 * Uploaded files
 ****************************************************************************/
.file-container {
  float: left;

  &.-is-loading {
    opacity: 0.5;
  }

  .on-mobile-medium-screen-720({
    float: none;
  });

  .file:hover .file-actions-container {
    display: block;
  }

  .file {
    @file-attachment-bg: white;
    @file-attachment-overlay-bg: #FCFCFC;
    @file-attachment-overlay-border-color: #EEEEEE;
    @file-attachment-height: 150px;
    @file-attachment-width: 300px;
    @file-attachment-border-color: #CCCCCC;
    @file-attachment-caption-height: 31px;

    border: 1px @file-attachment-border-color solid;
    box-shadow: @box-shadow;
    box-sizing: border-box;
    display: block;
    position: relative;
    margin: 1em 1.5em 0.5em 0;
    max-width: @file-attachment-width;
    transition: 0.2s opacity linear;
    width: @file-attachment-width;

    .on-mobile-medium-screen-720({
      margin: 1.5em 0 0 0;
    });

    .fa-spinner {
      font-size: (@file-attachment-height / 4);
      line-height: @file-attachment-height;
      vertical-align: middle;
      text-align: center;
    }

    /*
     * This container provides the padding necessary to display a shadow
     * around all but one edges of the actions list. We clip the shadow on
     * the side sharing a border with the file attachment thumbnail.
     */
    .file-actions-container {
      @shadow-padding: 4px;

      display: none;
      overflow: hidden;
      padding: @shadow-padding;
      position: absolute;
      left: 100%;
      top: -(@shadow-padding + 1px);
      z-index: @z-index-menu;

      &.left {
        padding-right: 0;

        .file-actions {
          border-right-color: @file-attachment-overlay-border-color;
          margin-left: @shadow-padding;
        }
      }

      &.right {
        padding-left: 0;

        .file-actions {
          border-left-color: @file-attachment-overlay-border-color;
        }
      }
    }

    .file-actions {
      background-color: @file-attachment-overlay-bg;
      border: 1px @file-attachment-border-color solid;
      box-shadow: @box-shadow;
      box-sizing: border-box;
      height: @file-attachment-height - @file-attachment-caption-height;
      list-style: none;
      margin: 0;
      padding: 0;
      white-space: nowrap;

      li {
        margin: 0;
        padding: 0;

        a {
          color: #333;
          display: block;
          padding: 0.5em 1em;
          text-decoration: none;

          &:hover {
            background: darken(@file-attachment-overlay-bg, 5%);
          }
        }
      }
    }

    .file-thumbnail-container {
      background: @file-attachment-bg;
      height: @file-attachment-height;
      text-align: center;

      a {
        color: black;
        text-decoration: none;
      }

      pre {
        font-size: x-small;
      }

      .thumbnail-properties () {
        box-sizing: border-box;
        max-height: @file-attachment-height;
        max-width: 100%;
        margin: 0;
        padding: 0;
      }

      .file-thumbnail-overlay {
        .thumbnail-properties();
        position: absolute;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: @z-index-event-overlay;
      }

      .file-thumbnail {
        .thumbnail-properties();
        border: 0;
        overflow: hidden;
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
        margin: auto;
      }

      .file-thumbnail-clipped {
        border: 0;
        overflow: hidden;
        text-align: left;
        padding: 1em 0 0 1em;
        font-size: 8pt;

        /* Override the styling used for the <pre>s for fields. */
        pre {
          background-color: transparent;
          border: 0;
          margin: 0;
          padding: 0;
        }
      }
    }

    .file-caption-container {
      @file-caption-padding: 30px;

      opacity: 0.9;
      background-color: @file-attachment-overlay-bg;
      border-top: 1px @file-attachment-overlay-border-color solid;
      bottom: 0;
      box-sizing: border-box;
      line-height: 2.5em;
      padding: 0 @file-caption-padding;
      position: absolute;
      text-align: center;
      z-index: @z-index-subevent-overlay;
      // The 2px here is to make it fit within the border of the parent element
      max-width: @file-attachment-width - 2px;
      width: @file-attachment-width - 2px;

      a {
        color: black;
        text-decoration: none;

        &.empty-caption {
          color: gray;
          font-style: italic;
        }
      }

      .file-caption {
        .ellipsize();
        opacity: 1;
        line-height: @file-attachment-caption-height;
        height: @file-attachment-caption-height;
        text-shadow: 0px 0px 2px white;

        .buttons {
          /*
           * This provides enough padding to cleanly cover much of any file
           * attachment's header below.
           */
          @buttons-padding-vert: 5px;


          /* Line up with .file's side borders. */
          margin: 0 0 0 (-1px - @file-caption-padding);

          background: darken(@file-attachment-bg, 5%);
          border: 1px @file-attachment-border-color solid;
          border-top: 0;
          border-radius: 0 0 @box-border-radius @box-border-radius;
          box-shadow: @box-shadow;
          box-sizing: border-box;
          display: block;
          padding: @buttons-padding-vert 0;
          position: absolute;
          text-align: center;
          width: @file-attachment-width;
          z-index: @z-index-deco;
        }
      }

      .inline-editor-form > input[type='text'] {
        background: transparent;
        border: 0;
        box-sizing: border-box;
        font-family: inherit;
        font-size: inherit;
        height: @file-attachment-caption-height;
        margin: 0;
        padding-bottom: 0;
        padding-top: 0;
        text-align: inherit;
        vertical-align: bottom;

        /*
         * The 4px is needed to align the input with the text. It matches
         * the margin between the text and pencil.
         */
        padding: 0 @edit-icon-margin 0 0;


        &:focus {
          outline: 0;
        }

        /*
         * The box shadow doesn't display correctly in file attachment
         * thumbnails, so hide it. There will be a red background instead.
         */
        &:not(:focus) {
          background: rgba(255, 0, 0, 0.15);
          box-shadow: none;
        }

        &::-ms-clear {
          display: none;
        }
      }

      .rb-icon-edit {
        vertical-align: middle;
        position: absolute;
        right: 6px;
        bottom: 6px;
      }
    }
  }
}


/****************************************************************************
 * Screenshots
 ****************************************************************************/
.screenshot-caption {
  background-color: #F6F6F6;
  border: 1px #999999 solid;
  border-top: 1px #CCCCCC solid;
  padding: 2px 8px;
  border-radius: 0 0 @box-border-radius @box-border-radius;

  img {
    vertical-align: bottom;
  }
}

.screenshot-container {
  background: white;
  float: left;
  display: inline;
  margin-bottom: 10px;
  margin-right: 10px;
  max-width: 400px;
  min-width: 130px;
  text-align: center;
  overflow: hidden;
  vertical-align: middle;
  position: relative;
  border-radius: @box-border-radius;

  &:hover {
    background-color: #F6F6F6;

    .screenshot-caption {
      background-color: #E6E6E6;
    }
  }

  a {
    color: black;
    text-decoration: none;
  }

  .image {
    border: 1px #999999 solid;
    border-bottom: 0;
    border-radius: @box-border-radius @box-border-radius 0 0;
    cursor: pointer;
    height: 100px;
    line-height: 100px;
    margin: 0 auto;
    vertical-align: bottom;

    img {
      border-radius: @box-inner-border-radius @box-inner-border-radius 0 0;
      vertical-align: middle;
    }
  }
}


/****************************************************************************
 * Screenshot Thumbnails
 ****************************************************************************/
#screenshot-thumbnails {
  margin: 2px;
  padding: 0.5em;

  &.dragover {
    border: 2px green dashed;
    display: block;
    margin: 0;
  }
}


/****************************************************************************
 * List of Attached Files
 ****************************************************************************/
#file-list-container.dnd-overlay-visible {
  display: block !important;
  margin: 0;

  /*
   * If there are no file attachments present when showing the drag and drop
   * overlay, this will default to being very short. Force it to be a minimum
   * height to give it enough heft to be a useful drop point.
   */
  min-height: 64px;
}

#file-list {
  margin: 0;
  padding: 0;

  /*
   * When hovering over a thumbnail, fade out all the other thumbnails, to both
   * provide focus to the thumbnail the user is hovering over, and to help
   * separate out the actions menu from other thumbnail contents.
   */
  .file.faded {
    opacity: 0.5;
  }

  h1.drop-indicator {
    clear: both;
    text-align: center;
  }
}


/****************************************************************************
 * Comment detail dialog
 ****************************************************************************/
.comment-dlg {
  border: 1px @comment-dlg-border-color solid;
  border-radius: @box-border-radius;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.35);
  cursor: default;
  margin-top: 8px;
  overflow: hidden;
  position: absolute;

  form {
    background-color: @comment-dlg-bg;
    display: block;
    padding: @comment-dlg-padding;

    .buttons {
      margin: 0;

      input[type="button"] {
        margin-right: (@comment-dlg-padding / 2);
      }
    }
  }

  h1 {
    background: transparent;
    border: 0;
    margin: 0;
    padding: 0;
  }

  img.ui-resizable-grip {
    /* Use -1 for bottom and right so it overlaps the resize borders. */
    bottom: -1px;
    cursor: se-resize;
    padding: 0.5em;
    position: absolute;
    right: -1px;
    z-index: @z-index-deco;
  }

  .comment-dlg-body,
  .comment-dlg-footer,
  .comment-dlg-header {
    position: relative;
  }

  .comment-dlg-footer {
    padding: @comment-dlg-padding 0 0 0;

    .status {
      display: none;
      font-style: italic;
      margin-bottom: @comment-dlg-padding;
    }
  }

  .comment-dlg-header {
    padding: 0 0 @comment-dlg-padding 0;
    line-height: 16px;

    .markdown-info {
      line-height: inherit;
    }
  }

  .comment-dlg-options {
    list-style: none;
    margin: 0;
    padding: @comment-dlg-padding 0 0 0;

    li {
      margin: (@comment-dlg-padding / 2) 0;
      padding: 0;

      &:first-child {
        margin-top: 0;
      }

      &:last-child {
        margin-bottom: 0;
      }
    }
  }

  .markdown-info {
    line-height: 16px;
  }

  .other-comments {
    background-color: @comment-dlg-other-comments-bg;
    border-right: 1px @comment-dlg-border-color solid;
    padding: @comment-dlg-padding;

    ul {
      background-color: white;
      border: 1px #333333 solid;
      list-style: none;
      margin: @comment-dlg-padding 0 0 0;
      overflow: auto;
      padding: 0;
      position: relative;

      li {
        padding: @comment-dlg-padding;

        &.even {
          background-color: #F3F3F3;
        }

        h2 {
          font-size: 90%;
          margin: 0 0 @comment-dlg-padding 0;
          padding: 0;

          .actions {
            font-weight: normal;
            right: @comment-dlg-padding;

            a {
              color: blue;
              cursor: pointer;
              text-decoration: none;
              margin-left: @comment-dlg-padding;
              padding: 3px;

              &:hover {
                background-color: #F6F6F6;
              }
            }
          }
        }

        pre {
          white-space: pre-wrap;
          font-size: 90%;
        }
      }
    }
  }

  .text-editor {
    border: @textarea-border;
    margin: 0;

    .CodeMirror, textarea {
      border: 0;
    }
  }

  .ui-icon-gripsmall-diagonal-se {
    background: url('@{img_base}/resize-grip.png') no-repeat top left;
  }
}

.issue-state {
  @issue-state-height: 26px;

  border: 1px transparent solid;
  font-weight: bold;
  line-height: @issue-state-height;
  margin-bottom: 2em;
  min-height: @issue-state-height;
  padding: 0.6em;
  transition: 0.1s linear all;
  visibility: hidden;

  input, .back-to-issue-summary {
    /*
     * This keeps a consistency with the browser. By default, Chrome uses
     * a margin of 2px, and changing it to 0 actually makes things look
     * off-center.
     */
    margin: 2px 2px 2px 0.2em;
    vertical-align: middle;
  }

  .issue-container {
    position: relative;
  }

  .rb-icon {
    margin: 0 0.2em;
  }

  &.dropped, &.open, &.resolved, &.verifying-resolved, &.verifying-dropped {
    visibility: visible;
  }

  &.dropped {
    background: @issue-discarded-bg;
    border-color: @issue-discarded-border-color;

    .back-to-issue-summary, .back-to-issue-summary:visited {
      color: @issue-discarded-link-color;
    }
  }

  &.open {
    background: @issue-opened-bg;
    border-color: @issue-opened-border-color;

    .back-to-issue-summary, .back-to-issue-summary:visited {
      color: @issue-opened-link-color;
    }
  }

  &.resolved {
    background: @issue-resolved-bg;
    border-color: @issue-resolved-border-color;

    .back-to-issue-summary, .back-to-issue-summary:visited {
      color: @issue-resolved-link-color;
    }
  }

  &.verifying-resolved,
  &.verifying-dropped {
    background: @issue-verifying-bg;
    border-color: @issue-opened-border-color;

    .back-to-issue-summary, .back-to-issue-summary:visited {
      color: @issue-opened-link-color;
    }
  }

  .back-to-issue-summary {
    font-size: 13px;
    font-weight: normal;
    text-decoration: none;
    padding: 0 0.5em;
    position: absolute;
    right: 0;
    height: 24px;
    line-height: 24px;

    &:hover {
      text-decoration: underline;
    }
  }

  .issue-message {
    margin-right: 0.5em;
    vertical-align: middle;
  }

  .on-mobile-medium-screen-720({
    .back-to-issue-summary {
      display: none;
    }

    .issue-actions {
      display: block;
      margin-top: 0.5em;

      input:first-child {
        margin-left: 0;
      }
    }

    .issue-details {
      display: inline-block;
      overflow: hidden;
      vertical-align: top;
    }
  });
}


/****************************************************************************
 * Banners
 ****************************************************************************/
#review-banner {
  overflow: hidden;

  &.hidden {
    max-height: 0;
    visibility: hidden;

    .banner {
      /*
       * Instead of hiding the banner, we keep the position off-screen by
       * default using a transform. This makes it easy to animate it on-screen
       * when putting it in the "shown" state.
       */
      transform: translateY(-100%);
    }
  }

  &.ui-ready {
    transition: max-height 0.3s linear, visibility 0.3s linear;

    .banner {
      /*
       * We only set the position as fixed when the UI is ready (JavaScript
       * has processed things). The reason for this is that when the page is
       * loading, we want the #review-banner to have the same height as the
       * draft banner, but the JavaScript wouldn't have executed yet, so it
       * wouldn't be able to force that height. So instead, we leave the
       * banner with a normal position, impacting #review-banner's height,
       * and ensuring the page doesn't jump. Then we convert it to fixed once
       * we've rendered everything.
       */
      position: fixed;
      left: 0;
      top: 0;
      transition: transform 0.3s linear;
    }
  }

  .banner {
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: @box-shadow;
    margin: 0;
    width: 100%;
    z-index: @z-index-banner;
  }
}


/****************************************************************************
 * Tooltips
 ****************************************************************************/
.tooltip {
  background-color: #fef6b3;
  border: 1px #a58600 solid;
  padding: 4px;
  position: absolute;
  max-width: 60em;

  &.comments {
    border: 1px black solid;
    border-bottom: 0;
    padding: 0;

    > ul {
      list-style: none;
      margin: 0;
      padding: 0;

      > li {
        background-color: @comments-tooltip-background;
        border-bottom: 1px @comments-tooltip-border-color solid;
        margin: 0;
        padding: @comments-tooltip-padding;

        &.draft {
          background-color: @comments-tooltip-draft-background;
          border-bottom: 1px black solid;
        }

        div {
          &.reviewer {
            font-weight: bold;
            margin-bottom: 1em;
          }
        }

        pre {
          font-size: 8pt;
          margin: 0;
          padding: 0;
          white-space: pre-wrap;
        }

        .rich-text {
          code {
            border-color: @comments-tooltip-border-color;
          }

          .codehilite {
            .flush-codehilite();
            border-color: @comments-tooltip-border-color;
            margin-left: -@comments-tooltip-padding;
            margin-right: -@comments-tooltip-padding;
          }
        }
      }
    }
  }
}


/****************************************************************************
 * Bubbles
 ****************************************************************************/
.bubble {
  background-color: white;
  border: 1px black solid;
  border-radius: 8px;
  font-size: 10pt;
  font-weight: bold;
  padding: 6px;
  position: absolute;
  white-space: nowrap;
  z-index: @z-index-dialog;
}


/****************************************************************************
 * "Update Diff" dialog
 ****************************************************************************/

.update-diff {
  width: 60em;
  height: 16em;

  #error-contents,
  #parent-diff-error-contents {
    margin: 0 5em;
  }

  .input {
    height: 16em;
    line-height: 16em;
    margin: 2em 2em 6em 2em;
    border: 1px solid #rb-ns-ui.colors[@grey-60];
  }

  .upload-diff-ui();
}


/****************************************************************************
 * Status Updates
 ****************************************************************************/

.status-update-header(@color, @border-color) {
  background-color: @color;
  border-color: @border-color;
  border-style: solid;
}

#initial-status-updates {
  .header {
    border-width: 0 0 1px 0;

    &.status-update-state-failure {
      .status-update-header(@diff-delete-color, @diff-delete-border-color);
    }

    &.status-update-state-pending,
    &.status-update-state-not-yet-run {
      .status-update-header(@diff-replace-color, @diff-replace-border-color);
    }

    &.status-update-state-success {
      .status-update-header(@diff-insert-color, @diff-insert-border-color);
    }
  }

  .review-request-page-entry-contents {
    overflow: hidden;

    &.collapsed .header {
      background-color: @review-request-entry-collapsed-bg;
      border-width: 0;
    }
  }
}

.status-update-review-header {
  border-width: 1px 0;
  margin: 0.75rem 0 -1px;
  padding: (@review-request-entry-padding / 2) @review-request-entry-padding;

  &.status-update-state-failure {
    .status-update-header(@diff-delete-color, @diff-delete-border-color);
  }

  &.status-update-state-pending,
  &.status-update-state-not-yet-run {
    .status-update-header(@diff-replace-color, @diff-replace-border-color);
  }

  &.status-update-state-success {
    .status-update-header(@diff-insert-color, @diff-insert-border-color);
  }
}

.status-update-review .banner {
  border-bottom-width: 0;
  margin-top: 1px;

  &.floating {
    border-bottom-width: 1px;
  }
}

.status-update-summary-entry {
  line-height: 14px;
  vertical-align: middle;

  &::before {
    font-size: 14px/1;
    font-family: FontAwesome;

    /* Set this up to allow for animations. We need position: absolute. */
    position: absolute;
  }

  .status-update-state(@color) {
    color: @color;
    padding: @review-request-entry-padding;

    .fa {
      margin-right: 0.5em;
    }
  }

  &.status-update-state-failure {
    .status-update-state(darkred);

    &::before {
      content: '\f00d';
    }
  }

  &.status-update-state-pending {
    .status-update-state(goldenrod);

    &::before {
      animation: fa-spin 2s infinite linear;
      content: '\f021';
      width: 11px;
      height: 14px;
    }
  }

  &.status-update-state-not-yet-run {
    .status-update-state(darkcyan);

    &::before {
      content: '\f04c';
    }
  }

  &.status-update-state-success {
    .status-update-state(darkgreen);

    &::before {
      content: '\f00c';
    }
  }

  .status-update-request-run {
    margin-left: 1em;
    margin-top: -5px;
  }

  .summary {
    font-weight: bold;

    /* This will cover the icon with spacing after. */
    margin-left: 2em;
  }

  a {
    float: right;
  }
}
